package com.htu.Base64;

import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Base64;

public class ImageBase64Converter {
    public static void main(String[] args) {
        String filePath = "C:\\Users\\huang\\Pictures\\shipin\\aa";
        try {
            Path path = Paths.get(filePath);
            byte[] imageData = Files.readAllBytes(path);
            String base64 = Base64.getEncoder().encodeToString(imageData);
            System.out.println(base64);
        } catch (Exception e) {

            e.printStackTrace();
        }
    }
}
